﻿@using System.Collections.Generic

<h2>Focus and activation</h2>

<p @onfocusin="OnFocusIn" @onfocusout="OnFocusOut">
    Input: <input id="input" type="text" @onfocus="OnFocus" @onblur="OnBlur"/>
</p>
<p>
    Output: <span id="output">@message</span>
</p>
<p>
    <button @onclick="Clear">Clear</button>
</p>

<p>
    Another input (to distract you) <input id="other" />
</p>

@code {

    string message;

    void OnFocus(FocusEventArgs e)
    {
        message += "onfocus,";
        StateHasChanged();
    }

    void OnBlur(FocusEventArgs e)
    {
        message += "onblur,";
        StateHasChanged();
    }

    void OnFocusIn(FocusEventArgs e)
    {
        message += "onfocusin,";
        StateHasChanged();
    }

    void OnFocusOut(FocusEventArgs e)
    {
        message += "onfocusout,";
        StateHasChanged();
    }

    void Clear()
    {
        message = string.Empty;
    }
}
